Assignemnt #106 and 106th program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: 106th Program
///File name: Hund6prog.java
///Date Finished:4/1/2016
import java.util.Scanner;
public class Hund6prog
{
public static void main( String[] args )
{
for( int x = 2; x<21; x++)
{
boolean prime = isPrime(x);
if(prime == true)
System.out.println( x + "<" );
else
System.out.println(x);
}
}
public static boolean isPrime(int n)
{
boolean i = true;
int j = 2;
while(i==true && j< n)
{
if(n%j == 0)
i = false;
j++;
}
return i;
}
}
Picture of the output